<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Arduino LibHelix: Helix MP3 decoder</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Arduino LibHelix
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="PageDoc"><div class="header">
  <div class="headertitle">
<div class="title">Helix MP3 decoder </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p><a class="anchor" id="md_README"></a> I am providing the <a href="https://en.wikipedia.org/wiki/Helix_Universal_Server">Helix MP3 decoder from RealNetworks</a> as a simple Arduino Library. The Helix decoders are based on 16bits integers, so they are a perfect fit to be used in Microcontrollers.</p>
<p>MP3 is a compressed audio file formats based on PCM. A 2.6 MB wav file can be compressed down to 476 kB MP3.</p>
<p>This project can be used stand alone or together with the <a href="https://github.com/pschatzmann/arduino-audio-tools">arduino-audio_tools library</a>. It can also be used from non Arduino based systems with the help of cmake.</p>
<p>The Helix MP3 decoder provides Layer 3 support for MPEG-1, MPEG-2, and MPEG-2.5. It supports variable bit rates, constant bit rates, and stereo and mono audio formats.</p>
<h2><a class="anchor" id="autotoc_md1"></a>
API Example</h2>
<p>The API provides the decoded data to a Arduino Stream or alternatively to a callback function. Here is a MP3 example using the callback:</p>
<div class="fragment"><div class="line">#include &quot;MP3DecoderHelix.h&quot;</div>
<div class="line">#include &quot;music_mp3.h&quot;</div>
<div class="line"> </div>
<div class="line">using namespace libhelix;</div>
<div class="line"> </div>
<div class="line">void dataCallback(MP3FrameInfo &amp;info, int16_t *pwm_buffer, size_t len) {</div>
<div class="line">    for (int i=0; i&lt;len; i+=info.channels){</div>
<div class="line">        for (int j=0;j&lt;info.channels;j++){</div>
<div class="line">            Serial.print(pwm_buffer[i+j]);</div>
<div class="line">            Serial.print(&quot; &quot;);</div>
<div class="line">        }</div>
<div class="line">        Serial.println();</div>
<div class="line">    }</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line">MP3DecoderHelix mp3(dataCallback);</div>
<div class="line"> </div>
<div class="line">void setup() {</div>
<div class="line">    Serial.begin(115200);</div>
<div class="line">    mp3.begin();</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line">void loop() {</div>
<div class="line">    Serial.println(&quot;writing...&quot;)</div>
<div class="line">    mp3.write(music_data, muslic_len);    </div>
<div class="line"> </div>
<div class="line">    // restart from the beginning</div>
<div class="line">    delay(2000);</div>
<div class="line">    mp3.begin();</div>
<div class="line">}</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md2"></a>
Documentation</h2>
<p>The <a href="https://pschatzmann.github.io/arduino-libhelix/html/annotated.html">class documentation can be found here</a> </p>
</div></div><!-- PageDoc -->
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
